package utils;

public class Matrix {
	private int[][] body;
	private int order;
	public Matrix(int n)
	{
		order=n;
		body = new int[n][n];
		for(int i=0;i<n;i++)
			for(int j=0;j<n;j++)
				body[i][j]=0;
	}
	public Matrix(Matrix n)
	{
		order=n.order;
		body = new int[order][order];
		for(int i=0;i<order;i++)
			for(int j=0;j<order;j++)
				body[i][j]=n.body[i][j];
	}
	
	public int order()
	{
		return order;
	}
	public void set(int i, int j, int val)
	{
		if(i > order || j > order || i< 0 || j <0)
			return;
		body[i][j]=val;
	}
	
	public int get(int i,int j)
	{
		if(i > order || j > order || i< 0 || j <0)
			throw new IndexOutOfBoundsException("");
		return body[i][j];
	}
	
	public int[] LeftMul(int[] arg)
	{
		int[] rez=new int[order];
		
		for(int i=0;i<order;i++)
		{
			int sum=0;
			for(int j=0; j < order; j++)
				sum+=arg[j]*body[j][i];
			rez[i]=sum;
		}
		
		return rez;
	}
	
}
